package com.app.server.impl;

import com.app.mapper.UnitsManagerMapper;
import com.app.mapper.UnitsRescueMapper;
import com.app.model.UnitsManagerModel;
import com.app.model.UnitsRescueModel;
import com.app.server.UnitsRescueService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UnitsRescueServiceImpl extends ServiceImpl<UnitsRescueMapper, UnitsRescueModel> implements UnitsRescueService {
    @Autowired
    private UnitsRescueMapper unitsRescueMapper;
    @Autowired
    private UnitsManagerMapper unitsManagerMapper;
    //统计已办结的动物救援任务
    @Override
    public List<Integer> getRescueCount() {
        List<Integer> animalData = unitsRescueMapper.getRescueCount();
//        List<Integer> animalData =new ArrayList<>();
//        List<UnitsManagerModel> unitsManagerModels = unitsManagerMapper.selectList(null);
//
//        for (UnitsManagerModel unitsManagerModel : unitsManagerModels) {
//            Integer id = unitsManagerModel.getId();
//            QueryWrapper<UnitsRescueModel> qw=new QueryWrapper<>();
//            qw.eq("units_id",id);
//            Integer rescue = unitsRescueMapper.selectCount(qw);
//            animalData.add(rescue);
//        }
        return animalData;
    }
}
